<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Smile</title>
    <!-- 引入 bootstar.css -->
   <link rel="stylesheet" th:href="@{/static/css/bootstrap.css}">
   <link rel="stylesheet" th:href="@{/static/css/photo.css}">
    <!-- 引入 layui.css -->
   <script src="/static/js/scriptindex.js"></script>
   <script src="/static/js/jquery.min.js"></script>
   <script src="/static/lib/layui/layui.js"></script>
   <script src="/static/js/bootstrap.js"></script>
   <script src="/static/lib/qrcode/qrcode.min.js"></script>
</head>
<body>
<script type="text/javascript">
   function bj(){
	  var opacity = document.getElementById("daohang").style.opacity;
	  if(opacity<1){
	    document.getElementById("daohang").style.opacity=1;
	  }else{
	    document.getElementById("daohang").style.opacity=0.8;
	  }
	 
	  if( ($("#fill").css("display"))!="none"){
	    $("#fill").css("display","none");
	  }else{
	    $("#fill").css("display","list-item");
	  }
	  }
	  
	  
	  	 //这个不是写在首页，写在子页面（子页面才能返回，写在首页点击返回就是退出）
//不用引入mui.js，都是h5方法
document.addEventListener('plusready', function() {
    var webview = plus.webview.currentWebview();
    plus.key.addEventListener('backbutton', function() {
        webview.canBack(function(e) {
            if(e.canBack) {
                webview.back();
            } else {
                webview.close(); //hide,quit
                //plus.runtime.quit();
            }
        })
    });
});
	  
</script>

    <!-- 头部的模板 -->
<div th:replace="fragment/head::head"></div> 
    

    
    <div class="container mt-4">
    
      <div class="row">
        <div class="col-12">
        
           <div class="card text-center"> 
               <div class="card-body ">
               
                 <div class="layui-anim layui-anim-scaleSpring input-group mb-3">
                     <input class="form-control" id="sr" type="text" placeholder="请输入网址">
                       <div class="input-group-append">
                         <button class="btn btn-success" onclick="sc()">生成</button>
                       </div>
                 </div>
                 
               </div>
           </div>
         
          </div>
      </div>
    
       <div class="row" style="margin-top: 20px">
       
         <div   class="col-12 col-sm-12 col-md-12">
         
          <div id="qrcode" ></div>

         </div>
   
          
        
   
   
   <!-- 对应row -->      
   </div>

    </div>
    
    <script type="text/javascript">
    function sc(){
        <!--生成二维码-->
    var url = document.getElementById("sr").value;
    if(url.length>0){
      var qrcode = new QRCode("qrcode", {
        text:url,
        width: 200,
        height: 200,
        colorDark : "#000000",
        colorLight : "#ffffff",
        correctLevel : QRCode.CorrectLevel.H
    });
    }else{
     alert("请输入网址")
    }
    } 
    
    
    </script>
  </body>
  </html>
    